<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
//Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
	'name'=>'My Web Application',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
		'application.modules.bootstrap.components.*'
	),
	'aliases' => array(
        //'TbHtml' => 'bootstrap.helpers.TbHtml',
		'bootstrap' => 'application.modules.bootstrap',
		//'BSHtml' => 'bootstrap.helpers.BSHtml',
    ),
	'modules'=>array(
		// uncomment the following to enable the Gii tool
		/*
		'gii'=>array(
			'class'=>'system.gii.GiiModule',
			'password'=>'Enter Your Password Here',
			// If removed, Gii defaults to localhost only. Edit carefully to taste.
			'ipFilters'=>array('127.0.0.1','::1'),
		),
		*/
		'bootstrap' => array(
			'class' => 'bootstrap.BootStrapModule'
		),
		'gii' => array(
			'generatorPaths' => array('bootstrap.gii'),
			'class' => 'system.gii.GiiModule',
			'password' => 'yaa',
			'ipFilters' => array('127.0.0.1','::1'),
		),
		/*'gii'=>array(
            'generatorPaths'=>array(
                'bootstrap.gii',
            ),
        ),*/
		'user'=>array(
            # encrypting method (php hash function)
            'hash' => 'md5',
 
            # send activation email
            'sendActivationMail' => true,
 
            # allow access for non-activated users
            'loginNotActiv' => false,
 
            # activate user on registration (only sendActivationMail = false)
            'activeAfterRegister' => false,
 
            # automatically login from registration
            'autoLogin' => true,
 
            # registration path
            'registrationUrl' => array('/user/registration'),
 
            # recovery password path
            'recoveryUrl' => array('/user/recovery'),
 
            # login form path
            'loginUrl' => array('/user/login'),
 
            # page after login
            'returnUrl' => array('/user/profile'),
 
            # page after logout
            'returnLogoutUrl' => array('/user/login'),
        ),
	),
	'theme'=>'bootstrap',
	// application components
	'components'=>array(
		'BSHtml' => array(
			'class' => 'bootstrap.components.BSHtml'
		),
		'user'=>array(
			'class' => 'WebUser',
			//enable cookie-based authentication
			'allowAutoLogin'=>true,
			'autoUpdateFlash' => true
		),
		// uncomment the following to enable URLs in path-format
		
		'urlManager'=>array(
			'urlFormat'=>'path',
			'showScriptName'=>false,
     		'caseSensitive'=>false, 
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
				//'<action:(login|logout)>' => 'user/<action>',
				//'<action:signup>' => 'user/create',
				'<action:admin>' => 'admin/user/index',
			),
		),
		
		/*'db'=>array(
			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
		),*/
		// uncomment the following to use a MySQL database
		
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=yii1114_cart',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => '',
			'charset' => 'utf8',
			'enableProfiling'=>true,
			'enableParamLogging'=>true,
			'tablePrefix' => 'tbl_'
		),
		
		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error,trace, warning',
				),
				/*array(
					'class'=>'ext.yii-debug-toolbar.YiiDebugToolbarRoute',
					//'ipFilters'=>array('127.0.0.1','180.215.77.33'),
				),*/
				// uncomment the following to show log messages on web pages
				/*
				array(
					'class'=>'CWebLogRoute',
				),
				*/
			),
		),
		/*'bootstrap'=>array(
            'class'=>'bootstrap.components.TbApi',
        ),*/
		/*'clientScript' => array(
			'class' => 'ext.yii-less-extension.components.YiiLessCClientScript',
			'cache' => true, // Optional parameter to enable or disable LESS File Caching
		),*/
		'clientScript' => array(
			'class' => 'ext.NLSClientScript.NLSClientScript',
			//'excludePattern' => '/\.tpl/i', //js regexp, files with matching paths won't be filtered is set to other than 'null'
			//'includePattern' => '/\.php/', //js regexp, only files with matching paths will be filtered if set to other than 'null'
		 
			'mergeJs' => true, //def:true
			'compressMergedJs' => true, //def:false
		 
			'mergeCss' => true, //def:true
			'compressMergedCss' => true, //def:false
		 
			'mergeJsExcludePattern' => '/edit_area/', //won't merge js files with matching names
		 
			'mergeIfXhr' => false, //def:false, if true->attempts to merge the js files even if the request was xhr (if all other merging conditions are satisfied)
		 
			//'serverBaseUrl' => 'http://localhost', //can be optionally set here
			'mergeAbove' => 1, //def:1, only "more than this value" files will be merged,
			'curlTimeOut' => 10, //def:10, see curl_setopt() doc
			'curlConnectionTimeOut' => 10, //def:10, see curl_setopt() doc
		 
			'appVersion'=>1.0 //if set, it will be appended to the urls of the merged scripts/css
		),
		/*'less'=>array(
		  'class'=>'ext.less.components.Less',
		  'mode'=>'server',
		  'files'=>array(
			'protected/extensions/bootstrap/assets/less/bootstrap.less'=>'protected/extensions/bootstrap/assets/css/bootstrap.css',
		  ),
		  'options'=>array(
			'nodePath'=>'node.exe', //C:\Program Files\nodejs\node.exe
			'compilerPath'=>'C:\Users\diamond\AppData\Roaming\npm\lessc.cmd',
			'forceCompile'=>false,
		  ),
		),*/
		'less'=>array(
            'class'=>'ext.LessCompiler',
            'compiledPath'=>'application.assets.css', // path to store compiled css files
            'formatter'=>'lessjs', // - lessjs / compressed / classic , see http://leafo.net/lessphp/docs/#output_formatting for details
            'forceCompile'=>false, // passing in true will cause the input to always be recompiled
            'disabled'=>false, // if set to true .less files will not compile if .css file found
        ),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
);